import java.util.*;
public class Main{
    public static int solution(int n,int[]arr){
        int count=0;
        int i=0;
        while(i<n){
            //遍历递增子序列
            if(arr[i]<arr[i+1]){
                while(i<n&&arr[i]<arr[i+1]){
                    i++;
                }
                count++;
                i++;
            }else if(arr[i]==arr[i+1]){
                i++;
            }else{
                //遍历递减子序列
                while(i<n&&arr[i]>arr[i+1]){
                    i++;
                }
                count++;
                i++;
            }
        }
        return count;
    }
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        //为防止下标越界，数组记得多加1个空间
        int[]arr=new int[n+1];
        for(int i=0;i<n;i++){
            arr[i]=sc.nextInt();
        }
        int ans=solution(n,arr);
        System.out.println(ans);
    }
}